// $Id: loadingbar.h 470 2008-05-27 16:27:22Z agjermun $
// Loadingbar class definition
//
// ml278
// Copyright (C) 2008 Bjørn Øivind Bjørnsen, Aleksander Gjermundsen, Knut Andre Tidemann, Thomas Hansen
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

#ifndef __LOADINGBAR_H_
#define __LOADINGBAR_H_
#include <OgreResourceGroupManager.h>
#include <OgreRenderWindow.h>

using namespace Ogre;

/**
 * Provides a simple Loading Bar.
 * Will be used when loading, values have to be set manually.
 * Holds a number of functions to set which scripts, resources and world geometry it is currently working on.
*/
class LoadingBar : public ResourceGroupListener
{
private:
	RenderWindow *mWindow;          /**< window onto which to render the loading bar */

        // XXX: The following comments should be revised by someone who know this code
	unsigned int mNumGroupsInit;    /**< initial increment selected */
	unsigned int mNumGroupsLoad;    /**< number of increments */
	float mInitProportion;          /**< initial value */
	float mProgressBarMaxSize;      /**< maximum value */
	float mProgressBarInc;          /**< increments on the progress bar */

public:
	LoadingBar(RenderWindow *win);
	~LoadingBar();

	void init();
	void hide();

	void setComment(const String &comment);
	void setDescription(const String &description);
	void setNonScriptProgress(Real progress);

	void resourceGroupScriptingStarted(const String &groupName, size_t scriptCount);
	void scriptParseStarted(const String &scriptName);
	void scriptParseEnded(const String &scriptName);
	void resourceGroupScriptingEnded(const String &groupName);
	void resourceGroupLoadStarted(const String &groupName, size_t resourceCount);
	void resourceLoadStarted(const ResourcePtr &resource);
	void resourceLoadEnded(void);
	void worldGeometryStageStarted(const String &description);
	void worldGeometryStageEnded(void);
	void resourceGroupLoadEnded(const String &groupName);

};


#endif
